This sample shows you how to use the Windows Runtime display request API to keep the display on during extended periods without user activity.
To conserve power and extend battery life, Windows reduces power to the computer if it does not detect any user activity for a period of time. Depending on power settings the user chooses, the display might first be dimmed, then turned off as the computer enters a low-power sleep state. The display request API enables a Windows Store app to keep the display on after it would otherwise be dimmed or turned off.
This sample demonstrates the following tasks:
- Creating a display request
- Activating a display request
- Deactivating a display request
- Tracking the number of active display requests
To obtain an evaluation copy of Windows 8.1, go to Windows 8.1.
To obtain an evaluation copy of Microsoft Visual Studio 2013, go to Visual Studio 2013.
Note For Windows 8 app samples, download the Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.
Related topics
Operating system requirements
| Client | |
|---|---|
| Server |
Build the sample
- Start Visual Studio 2013 and select File > Open > Project/Solution.
- Go to the directory in which you unzipped the sample. Go to the directory named for the sample, and double-click the Microsoft Visual Studio Solution (.sln) file.
- Press F7 or use Build > Build Solution to build the sample.
Run the sample
To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.
To see the effect of this sample on the display, you might want to modify your system's power settings so it enters standby-connected or sleep in a shorter amount of time. Run the sample and activate the request. The display should remain on even after the standby-connected/sleep timeout elapses.